/*
 * @lc app=leetcode.cn id=88 lang=typescript
 *
 * [88] 合并两个有序数组
 */

// @lc code=start
/**
 Do not return anything, modify nums1 in-place instead.
 */
function merge(nums1: number[], m: number, nums2: number[], n: number): void {
    let pos = m + n - 1
    m = m - 1
    n = n - 1

    while(n >= 0) {
        if (nums1[m] > nums2[n]) {
            nums1[pos] = nums1[m]
            m = m - 1
        }
        else {
            nums1[pos] = nums2[n]
            n = n - 1
        }
        pos = pos - 1
    }
};
// @lc code=end

